#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <sstream>
using namespace std;

typedef struct node{
    int value;
    int left;
    int right;
}node;
vector<string> a;
vector<node>nodes;
static vector<int> thenumbers;

void inorder(int root){
    if (nodes[root].left!=-1){
        inorder(nodes[root].left);
    }
    thenumbers.push_back(nodes[root].value);
    if (nodes[root].right!=-1){
        inorder(nodes[root].right);
    }
    return;
}


int main(){
    string ch,temp;
    getline(cin, ch);
    stringstream ss(ch);
    
    while(getline(ss, temp, ' ')){
        a.push_back(temp);
    }
    
    
    //printf("count");
    
    int child=1;
    node root;
    root.value=stoi(a[0]);
    root.left=-1;
    root.right=-1;
    nodes.push_back(root);
    int i=0;
    while(child<a.size()&&i<nodes.size()){
        
        if (a[child]!="null"){
            node childNode;
            childNode.value=stoi(a[child]);
            childNode.left=-1;
            childNode.right=-1;
            nodes.push_back(childNode);
            nodes[i].left=nodes.size()-1;
        }
        child++;
        if (child<a.size()&&a[child]!="null"){
            node childNode;
            childNode.value=stoi(a[child]);
            childNode.left=-1;
            childNode.right=-1;
            nodes.push_back(childNode);
            nodes[i].right=nodes.size()-1;
        }
        child++;
        i++;
        //printf("1");
    }
    //for (int i=0;i<nodes.size();i++) printf("%d %d %d \n",nodes[i].value,nodes[i].left,nodes[i].right);
    inorder(0);
    for (int i=0; i<thenumbers.size()-1; i++){
        if(thenumbers[i]>=thenumbers[i+1]){
            cout<<"false"<<endl;
            return 0;
        }
    }
    cout<<"true"<<endl;
    
    return 0;
}